home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / bbs / pprd199.zip / PPRD.H < prev    next >
C/C++ Source or Header  |  1996-07-18  |  2KB  |  94 lines

  1. #define    LPDPORT    515        /* TCP */
  2.  
  3. #define    LOGPORT    514        /* UDP */
  4.  
  5. #define    LOG_TAG    "<54>"        /* LOG_LPR + LOG_INFO */
  6.  
  7. #define    JDPORT    9100        /* direct to printer */
  8.  
  9. enum connstate
  10. {
  11.     INIT,
  12.     WAITING,
  13.     QUEUENAME,
  14.     RECVJOB,
  15.     CONTROLINFO,
  16.     CONTROL,
  17.     DATAINFO,
  18.     DATA,
  19.     PRINTING,
  20.     NAKANDCLOSE,
  21.     CLOSING,
  22.     CLOSING_NOSTATS,
  23.     ABORT
  24. };
  25.  
  26. #define    MAXTURNS    8            /* for initial network reads */
  27. #define    PRINT_CHUNK    2048            /* bytes to print at a time */
  28.  
  29. struct conn_info
  30. {
  31.     enum connstate    state;            /* of a connection */
  32.     int        nturns;            /* schedule slices */
  33.     int        controlfirst;        /* control data first? */
  34.     int        printer;        /* 0 to 2 */
  35.     tcp_Socket    sock;            /* connection */
  36.     long        bytelen;        /* of current file */
  37.     char far    *buffer;        /* for data */
  38.     char far    *bufip;            /* input point */
  39.     char far    *bufop;            /* output point */
  40.     char        jobname[32];
  41.     char        username[32];
  42.     char        hostname[32];
  43.     time_t        starttime;
  44.     long        joblen;
  45. };
  46.  
  47. /* kb per buffer. Don't increase this beyond 63. Bad things happen if you do.
  48.    It has to do with far pointers and wraparound of the offset part. */
  49. #define    BUFFER_SIZE    63U
  50.  
  51. extern unsigned int    buffer_size;
  52.  
  53. #define    reset_ptrs(c)    (c)->bufip = (c)->bufop = (c)->buffer
  54. #define    buffer_room(c)    ((c)->buffer - (c)->bufip + buffer_size)
  55. #define    queue_empty(c)    ((c)->bufip == (c)->bufop)
  56. #define    queue_room(c)    ((c)->bufip < (c)->bufop ? \
  57.                 (c)->bufop - (c)->bufip - 1 : \
  58.                 buffer_size - 1 - ((c)->bufip - (c)->bufop))
  59.  
  60. enum pstate
  61. {
  62.     NONESUCH = 0,
  63.     DISABLED,
  64.     FREE,
  65.     BUSY,
  66. };
  67.  
  68. struct lpt_info
  69. {
  70.     enum pstate    avail;            /* active? */
  71.     int        status;            /* from last biosprint */
  72.     int        hwaddr;            /* port address, != 0 == use */
  73. };
  74.  
  75. #define    bios_printer_init(i)    biosprint(1,0,i)
  76. #define    bios_printer_status(i)    biosprint(2,0,i)
  77. #define    bios_printer_outch(i,c)    biosprint(0,c,i)
  78.  
  79. /* printer status bits */
  80. #define    P_TIMEOUT    0x01
  81. #define    P_IOERROR    0x08
  82. #define    P_SELECTED    0x10
  83. #define    P_NOPAPER    0x20
  84. #define    P_ACK        0x40
  85. #define    P_IDLE        0x80
  86.  
  87. #define    P_CHANGES    (P_TIMEOUT|P_IOERROR|P_SELECTED|P_NOPAPER)
  88. #define    P_READY        (P_SELECTED|P_IDLE)
  89.  
  90. /* key definitions */
  91. #define    CF1    0x5e                /* CTRL-F1 */
  92. #define    CF2    0x5f
  93. #define    CF3    0x60
  94.